package name.matthewgreet.example4.action; import javax.servlet.http.HttpSession; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.InterceptorRef; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import com.opensymphony.xwork2.ActionSupport; import name.matthewgreet.example4.common.AbstractViewActionSupport; import name.matthewgreet.example4.common.ListCache; import name.matthewgreet.example4.common.NA; import name.matthewgreet.example4.dto.GameDTO; import name.matthewgreet.example4.util.GameCompositeCache; import name.matthewgreet.example4.view.GameDetailDisplay; /** * Displays game statistics. */ @InterceptorRef("ViewStack") @Results({ @Result(name=ActionSupport.SUCCESS, location="/pages/Game.jsp") }) public class ViewGameAction extends AbstractViewActionSupport { private static final long serialVersionUID = -7979376337555804889L; private Integer recordNo; private String refresh; private GameDetailDisplay display; @Action("/ViewGame") @Override public String execute() throws Exception { ListCache<NA,Integer,GameDTO> listCache; HttpSession session; session = getRequest().getSession(); listCache = GameCompositeCache.getInstance(session).getMasterListCache(); if (refresh != null) { listCache.forceReload(); } if (recordNo != null) { listCache.setSelectedIndex(recordNo - 1); } display = new GameDetailDisplay(listCache); display.init(); return SUCCESS; } public String getRefresh() { return refresh; } public void setRefresh(String refresh) { this.refresh = refresh; } public Integer getRecordNo() { return recordNo; } public void setRecordNo(Integer recordNo) { this.recordNo = recordNo; } public GameDetailDisplay getDisplay() { return display; } }